# 引用高德基础镜像，上线指南参考 https://yuque.antfin-inc.com/infrastructure2.0/pouch/zi67xn
FROM reg.docker.alibaba-inc.com/aone-base-global/gaode_7u2_java_springboot:1.1

# 如果需要修改配置文件或者脚本，需要将变更后的文件拷贝到镜像中
RUN rm -rf /home/admin/$APP_NAME/{bin,conf} /home/admin/cai/{bin,conf}
COPY environment/common/app/ /home/admin/$APP_NAME/
COPY environment/common/cai/ /home/admin/cai/
RUN chmod -R a+x /home/admin/$APP_NAME/bin/ /home/admin/cai/bin/

# 升级nginx
COPY environment/common/tengine-proxy-2.5.3-20210817194811.el7u2.x86_64.rpm /home/admin/tengine-proxy-2.5.3-20210817194811.el7u2.x86_64.rpm
RUN rpm -ivh /home/admin/tengine-proxy-2.5.3-20210817194811.el7u2.x86_64.rpm

RUN sudo rpm -ivh --nodeps "http://yum.corp.taobao.com/taobao/7/x86_64/current/ajdk11/ajdk11-11.0.18.17-20230523113044.alios7.x86_64.rpm"
RUN sudo rm -rf /opt/taobao/java
RUN sudo ln -s /opt/taobao/install/ajdk11_11.0.18.17/ /opt/taobao/java


# java springboot 模板配置--spring.profiles.active环境参考文档：https://yuque.antfin-inc.com/infrastructure2.0/pouch/cvsh2y#fe919ee6
ARG ENV_TYPE
RUN sed -i "s/--spring.profiles.active=production/--spring.profiles.active=$ENV_TYPE/" /home/admin/$APP_NAME/bin/setenv.sh

# 将构建出的主包复制到指定镜像目录中
COPY ${APP_NAME}.tgz /home/admin/${APP_NAME}/target/${APP_NAME}.tgz
